package com.wnhz.work.yz.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;

import com.wnhz.work.yz.BaseActivity;
import com.wnhz.work.yz.R;

public class BossShenHeActivity extends BaseActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_boss_shen_he);
        initData();
        initView();
    }

    private void initData() {
    }

    private RadioGroup rg;
    private RadioButton boss_li, boss_no;
    private EditText boos_edit;

    private void initView() {
        TextView title = (TextView) findViewById(R.id.view_main_middle_title);
        title.setText("审核");
        TextView view_main_left_text = (TextView) findViewById(R.id.submit);
        view_main_left_text.setText("提交");
        rg = (RadioGroup) findViewById(R.id.rg);
        boss_li = (RadioButton) findViewById(R.id.boss_li);
        boss_no = (RadioButton) findViewById(R.id.boss_nor);
        boos_edit = (EditText) findViewById(R.id.boos_edit);
        rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
            }
        });
        view_main_left_text.setVisibility(View.VISIBLE);
        findViewById(R.id.btn_main_left).setOnClickListener(this);
        view_main_left_text.setOnClickListener(this);

    }


    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_main_left:
                finish();
                break;
            case R.id.submit:

                Intent intent = new Intent();
                intent.putExtra("flag", boss_li.isChecked());
                String str = boos_edit.getText().toString().trim();
                String isTongYi = boss_li.isChecked() ? "同意" : "不同意";
                intent.putExtra("message", str.equals("") ? isTongYi : str);
                intent.putExtra("budget_id", getIntent().getStringExtra("budget_id"));
                setResult(RESULT_OK, intent); //intent为A传来的带有Bundle的intent，当然也可以自己定义新的Bundle
                finish();//此处一定要调用finish()方法
                break;
        }
    }
}
